|
|
|
|
|
|
|
Set fldTemp = tdTemp.CreateField("City", dbText, 25)
tdTemp.Fields.Append fldTemp
Set fldTemp = tdTemp.CreateField("StateProv", dbText, 25)
tdTemp.Fields.Append fldTemp
Set fldTemp = tdTemp.CreateField("Zip", dbText, 10)
tdTemp.Fields.Append fldTemp
Set fldTemp = tdTemp.CreateField("Phone", dbText, 14)
tdTemp.Fields.Append fldTemp
Set fldTemp = tdTemp.CreateField("CustomerType", dbText, 10)
tdTemp.Fields.Append fldTemp
'Build the Primary Key index to the Customers table
Set idxTemp = tdTemp.CREATEINDEX(cidxCustomers)
idxTemp.PRIMARY = True
idxTemp.Required = True
Set fldTemp = tdTemp.CreateField("CustomerID")
idxTemp.Fields.Append fldTemp
tdTemp.Indexes.Append idxTemp
'Add the Customers table to the databases
dbFile.TableDefs.Append tdTemp
'Create the Customer Types table
Set tdTemp = dbFile.CreateTableDef(ctblCustomerTypes)
'Insert fields into the Customer Types table
Set fldTemp = tdTemp.CreateField("CustomerType", dbText, 10)
tdTemp.Fields.Append fldTemp
Set fldTemp = tdTemp.CreateField("Description", dbText, 10)
tdTemp.Fields.Append fldTemp
'Build the Primary Key index for the Customer Types table
Set idxTemp = tdTemp.CREATEINDEX(cidxCustomerTypes)
idxTemp.PRIMARY = True
idxTemp.Required = True
Set fldTemp = tdTemp.CreateField("CustomerType")
idxTemp.Fields.Append fldTemp
tdTemp.Indexes.Append idxTemp
'Add the CustomerTypes table to the database
dbFile.TableDefs.Append tdTemp
'Create the relationship
Set relTemp = dbFile.CreateRelation(crelName)
relTemp.TABLE = ctblCustomerTypes
_' The table that contains the validation information
relTemp.ForeignTable = ctblCustomers
_' The table that utilizes the validation table
Set fldTemp = relTemp.CreateField("CustomerType")
fldTemp.ForeignName = "CustomerType"
relTemp.Fields.Append fldTemp
dbFile.Relations.Append relTemp
'Issue a message when the procedure is completed
MsgBox "Database build is complete"
End Sub |
|
|
|
|
|